home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / SPX20.ZIP / SPX_DOC.ZIP / SPX_DOS.DOC < prev    next >
Text File  |  1993-09-15  |  3KB  |  89 lines

  1. { SPX Library Version 2.0  Copyright 1993 Scott D. Ramsay }
  2.  
  3.  SPX_DOS is a generic file and memory handling unit.
  4.  
  5. ───────────────────────────────────────────────────────────────────────────
  6. function OpenDos(FileName:string):word;
  7.  
  8.   Open a file for reading.
  9.  
  10.     FILENAME:  File to read
  11.  
  12.   Returns a handle to the open file or 0 if an error
  13.  
  14. ───────────────────────────────────────────────────────────────────────────
  15. procedure ReadDos(Handle:word;Buffer:pointer;var size:word;Var Error:byte);
  16.  
  17.   Read data from a file opened from OpenDos
  18.  
  19.     HANDLE:   handle to the open file
  20.     BUFFER:   pointer to the buffer to store the data
  21.     SIZE:     number of bytes to read
  22.     ERROR:    0 no error, or dos error code
  23.  
  24. ───────────────────────────────────────────────────────────────────────────
  25. procedure SeekDos(Handle:word;position:longint);
  26.  
  27.   Change the file position of the file.
  28.  
  29.     HANDLE:     handle to the open file
  30.     POSITION:   the absolute positon of the file (in bytes)
  31.  
  32. ───────────────────────────────────────────────────────────────────────────
  33. function PosDos(Handle:word):longint;
  34.  
  35.   Returns the current position of the file (in bytes).
  36.  
  37.     HANDLE:  handle to the open file.
  38.  
  39. ───────────────────────────────────────────────────────────────────────────
  40. procedure CloseDos(var Handle:word);
  41.  
  42.   Closes an open file.
  43.  
  44.     HANDLE:  handle to the file to close
  45.  
  46. ───────────────────────────────────────────────────────────────────────────
  47. function malloc(size:word):pointer;
  48.  
  49.   Allocates memory up to 64k bytes.  Uses the TP heap space.  Does memory
  50.   checking.
  51.  
  52.   SIZE:  The number of bytes to allocate
  53.  
  54.   Returns a pointer to the memory block or NIL if could not allocate
  55.   memory.
  56.  
  57.   You can use freely with GetMem/FreeMem.  Do not use with MARK/RELEASE.
  58.  
  59. ───────────────────────────────────────────────────────────────────────────
  60. procedure free(var p:pointer);
  61.  
  62.   Deallocte a memory block allocated from malloc.
  63.  
  64.   P:  Pointer to the memory block to be freed.
  65.  
  66.   Returns P := NIL
  67.  
  68.   You can use freely with GetMem/FreeMem.  Do not use with MARK/RELEASE.
  69.  
  70. ───────────────────────────────────────────────────────────────────────────
  71. function GetPtr(p:pointer;offset:longint):pointer;
  72.  
  73.    Creates a new pointer at P+offset.  Adjusts for segment boundries.
  74.    Returns the new pointer location.  Note: offset MUST be positive or zero.
  75.  
  76.    P:        pointer to adjust
  77.    OFFSET:   offset for the pointer (in bytes)
  78.  
  79.    EXAMPLE:
  80.  
  81.    var
  82.      p : pointer;
  83.  
  84.    p := GetPtr(SomePointer,88000);
  85.  
  86.    { p points to 88000 bytes past SomePointer }
  87.  
  88.  
  89. ───────────────────────────────────────────────────────────────────────────